//
//  VerifyCardView.m
//  YTwallet
//
//  Created by ZhangLin on 2019/3/29.
//  Copyright © 2019年 hadrlog. All rights reserved.
//

#import "VerifyCardView.h"
#import <Masonry.h>
@implementation VerifyCardView

-(instancetype)initWithFrame:(CGRect)frame{
    if (self = [super initWithFrame:frame]) {
        [self setupViews];
    }
    return self;
}

-(void)setupViews{
    self.topView = [[UIView alloc] init];
    self.topView.backgroundColor = [UIColor whiteColor];
    [self addSubview:self.topView];
    [self.topView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(0);
        make.right.mas_equalTo(0);
        make.top.mas_equalTo(10);
        make.height.mas_equalTo(180);
    }];
    
    self.holdCardNameLab = [[UILabel alloc] init];
    self.holdCardNameLab.text = @"持卡人姓名";
    self.holdCardNameLab.textColor = ETColorWithRGB(153, 153, 153);
    self.holdCardNameLab.font = [UIFont systemFontOfSize:14];
    [self.topView addSubview:self.holdCardNameLab];
    
    self.bankCardLab = [[UILabel alloc] init];
    self.bankCardLab.text = @"银行卡号";
    self.bankCardLab.textColor = ETColorWithRGB(153, 153, 153);
    self.bankCardLab.font = [UIFont systemFontOfSize:14];
    [self.topView addSubview:self.bankCardLab];
    
    self.phoneLab = [[UILabel alloc] init];
    self.phoneLab.text = @"预留手机号";
    self.phoneLab.textColor = ETColorWithRGB(153, 153, 153);
    self.phoneLab.font = [UIFont systemFontOfSize:14];
    [self.topView addSubview:self.phoneLab];
    
    //竖向排列
    
    NSMutableArray *VerticalArray = [NSMutableArray array];
    [VerticalArray addObject:self.holdCardNameLab];
    [VerticalArray addObject:self.bankCardLab];
    [VerticalArray addObject:self.phoneLab];
    
    [VerticalArray mas_distributeViewsAlongAxis:(MASAxisTypeVertical) withFixedSpacing:30 leadSpacing:30 tailSpacing:30];
    [VerticalArray mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(15);
    }];
    
    self.holdCardNameValueLab = [[UILabel alloc] init];
    self.holdCardNameValueLab.text = @"王小白";
    self.holdCardNameValueLab.textColor = ETColorWithRGB(51, 51, 51);
    self.holdCardNameValueLab.font = [UIFont systemFontOfSize:14];
    [self.topView addSubview:self.holdCardNameValueLab];
    [self.holdCardNameValueLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.holdCardNameLab.mas_right).offset(35);
        make.centerY.equalTo(self.holdCardNameLab);
    }];
    
    self.bankCardValueLab = [[UILabel alloc] init];
    self.bankCardValueLab.text = @"**** **** **** 8940";
    self.bankCardValueLab.textColor = ETColorWithRGB(51, 51, 51);
    self.bankCardValueLab.font = [UIFont systemFontOfSize:14];
    [self.topView addSubview:self.bankCardValueLab];
    [self.bankCardValueLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.holdCardNameLab.mas_right).offset(35);
        make.centerY.equalTo(self.bankCardLab);
    }];
    
    self.phoneValueLab = [[UILabel alloc] init];
    self.phoneValueLab.text = @"138 **** 8987";
    self.phoneValueLab.textColor = ETColorWithRGB(51, 51, 51);
    self.phoneValueLab.font = [UIFont systemFontOfSize:14];
    [self.topView addSubview:self.phoneValueLab];
    [self.phoneValueLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.holdCardNameLab.mas_right).offset(35);
        make.centerY.equalTo(self.phoneLab);
    }];
    
    
    
    
    self.securityCodeView = [[UIView alloc] init];
    self.securityCodeView.backgroundColor = [UIColor whiteColor];
    [self addSubview:self.securityCodeView];
    [self.securityCodeView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(0);
        make.right.mas_equalTo(0);
        make.top.equalTo(self.topView.mas_bottom).offset(10);
        make.height.mas_equalTo(54);
    }];
    
    
    self.securityCodeLab = [[UILabel alloc] init];
    self.securityCodeLab.text = @"验证码";
    self.securityCodeLab.font = [UIFont systemFontOfSize:14.0f];
    self.securityCodeLab.textColor = [UIColor colorWithRed:102 / 255.0 green:102 / 255.0 blue:102 / 255.0 alpha:1];
    [self.securityCodeView addSubview:self.securityCodeLab];
    [self.securityCodeLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.securityCodeView).offset(15);
        make.centerY.equalTo(self.securityCodeView);
        make.width.mas_equalTo(50);
    }];
    
    
    
    self.securityCodeLineView = [[UIView alloc] init];
    self.securityCodeLineView.backgroundColor = [UIColor colorWithRed:229 / 255.0 green:229 /255.0 blue:229 / 255.0 alpha:1];
    [self.securityCodeView addSubview:self.securityCodeLineView];
    [self.securityCodeLineView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.securityCodeView);
        make.right.equalTo(self.securityCodeView);
        make.bottom.equalTo(self.securityCodeView);
        make.height.mas_equalTo(1);
    }];
    
    self.sendSMSBtn = [UIButton buttonWithType:(UIButtonTypeCustom)];
    [self.sendSMSBtn setTitle:@"发送验证码" forState:(UIControlStateNormal)];
    [self.sendSMSBtn setTitleColor:[UIColor colorWithRed:49/255.0 green:138/255.0 blue:255/255.0 alpha:1.0] forState:(UIControlStateNormal)];
    self.sendSMSBtn.titleLabel.font = [UIFont systemFontOfSize:14.0f];
    [self.securityCodeView addSubview:self.sendSMSBtn];
    [self.sendSMSBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(self.securityCodeLineView).offset(-15);
        make.centerY.equalTo(self.securityCodeView);
        make.width.mas_equalTo(75);
    }];
    
    self.verticalLineView = [[UIView alloc] init];
    self.verticalLineView.backgroundColor = [UIColor colorWithRed:229 / 255.0 green:229 / 255.0 blue:229 / 255.0 alpha:1];
    [self.securityCodeView addSubview:self.verticalLineView];
    [self.verticalLineView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(self.sendSMSBtn.mas_left).offset(-10);
        make.centerY.equalTo(self.securityCodeView);
        make.top.mas_equalTo(10);
        make.width.mas_equalTo(1);
    }];
    
    self.securityCodeNumTf = [[UITextField alloc] init];
    self.securityCodeNumTf.placeholder = @"短信验证码";
    self.securityCodeNumTf.keyboardType = UIKeyboardTypeNumberPad;
    self.securityCodeNumTf.font = [UIFont systemFontOfSize:16.0f];
    self.securityCodeNumTf.textAlignment = NSTextAlignmentLeft;
    self.securityCodeNumTf.clearButtonMode = UITextFieldViewModeWhileEditing;
    [self.securityCodeView addSubview:self.securityCodeNumTf];
    [self.securityCodeNumTf mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.securityCodeLab.mas_right).offset(30);
        make.centerY.equalTo(self.securityCodeView);
        make.right.equalTo(self.verticalLineView.mas_left).offset(-10);
    }];
    
    
    
}

@end
